<?php
require_once('page.php');
//------------------------------------------------------------
// Set some values into the template engine
//------------------------------------------------------------
$eng->assign("PageTitle", "RadTemplate");
$eng->assign("PageSubTitle", "Example 5a - Iteration using ForArray");

//------------------------------------------------------------
// Declare the Top Five Reasone Array
//------------------------------------------------------------
$arrTopFive = array("Fast", "Flexible", "Extensible", "Powerful", "Free");

$eng->assign("ListMessage", "Top Five Reasons to use RadTemplate (ForArray)");

//------------------------------------------------------------
// Put Array into values Collection
//------------------------------------------------------------
$eng->assign("TopFive", $arrTopFive);

//------------------------------------------------------------
// The iterator I chose requires that I define
// this particular function for it to call.
//------------------------------------------------------------
function OnItem($node, $val, $status) {
	$node->assign("ListValue", $val . "-----First=" . $status->First . "|Last=".$status->Last."|Even=".$status->Even."|Odd=".
		$status->Odd."|Index=".$status->Index);
	// return True to continue, False to stop iteration early
	return TRUE;
}

//------------------------------------------------------------
// NOTE:
//------------------------------------------------------------
// There are two other predefined ArrayIterators
// iterators CForItemJ, or CForItemK which invoke the
// OnItemJ( ) and OnItemK( ) functions.

//------------------------------------------------------------
// Load the template and Generate Ouput
//------------------------------------------------------------
$eng->show("tpl/test05a.html");
?>